using System;
using UnityEngine;
using UnityEngine.UI;

namespace CGF
{
    //该脚本自动生成或覆盖，不可编辑
    public partial class PanelLeaseDevicesDetail
    {   
		public CButton BtnBack;
		public InputField InputNum;
		public CButton BtnSub;
		public CButton BtnAdd;
		public Text TextTotalPrice;
		public CButton BtnLease;
		public RectTransform Header;
		public Image StartsFor;
		public Text TextTitle;
		public Text TextCountry;
		public Text TextModel;
		public Text TextPrice;
		public Text TextSpeed;
		public Text TextVersion;
		public Text TextContent;
		public Text Income;
		public RectTransform Device;
		public Image Bg;
		public Image HeadBg;
		public Image Bottom;
		public I18N i18n;

        public Reference reference { get; private set; }
        public Action onProsBindCompleted;
        public bool isProsBindCompleted;
        
        public void BindProperties(Transform transform)
        {   
            reference = transform.GetComponent<Reference>();
            if(!reference)return;
            int nodeIndex = 0;
			BtnBack = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			InputNum = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<InputField>();
			BtnSub = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			BtnAdd = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			TextTotalPrice = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			BtnLease = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<CButton>();
			Header = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<RectTransform>();
			StartsFor = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			TextTitle = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			TextCountry = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			TextModel = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			TextPrice = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			TextSpeed = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			TextVersion = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			TextContent = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			Income = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Text>();
			Device = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<RectTransform>();
			Bg = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			HeadBg = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			Bottom = (reference.nodes[nodeIndex++].obj as GameObject).GetComponent<Image>();
			i18n = transform.GetComponent<I18N>();
            isProsBindCompleted = true;
            onProsBindCompleted?.Invoke();
        }
        
        public void SetProsBindCompletedAction(Action action)
        {
            if (isProsBindCompleted)
            {
                action?.Invoke();
            }
            else
            {
                onProsBindCompleted = action;
            }
        }

		public string I18N_cell_tip { get { return i18n.GetTextByKey("cell_tip"); } }
		public string I18N_country { get { return i18n.GetTextByKey("country"); } }
		public string I18N_model { get { return i18n.GetTextByKey("model"); } }
		public string I18N_speed { get { return i18n.GetTextByKey("speed"); } }
		public string I18N_version { get { return i18n.GetTextByKey("version"); } }
    }
}
